package com.xyht.sca_s.student_manage_system.modules.asset.controller;


import com.xyht.sca_s.student_manage_system.common.commonReturn.ResponseResult;
import com.xyht.sca_s.student_manage_system.common.desEncodeAndDecode.annotation.SecretBody;
import com.xyht.sca_s.student_manage_system.modules.asset.entity.req.SmsAssetProcessDetailDeleteReq;
import com.xyht.sca_s.student_manage_system.modules.asset.entity.req.SmsAssetProcessDetailReq;
import com.xyht.sca_s.student_manage_system.modules.asset.service.SmsAssetProcessService;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 资产管理流程管理 前端控制器
 * </p>
 *
 * @author XYHT
 * @since 2023-05-12
 */
@RestController
@RequestMapping("/asset/process")
@SecretBody
public class SmsAssetProcessController {
    @Autowired
    private SmsAssetProcessService smsAssetProcessService;

    @ApiModelProperty(value = "添加流程节点")
    @PostMapping("/add")
    public ResponseResult addProcessDetail(@RequestBody @Validated SmsAssetProcessDetailReq smsAssetProcessDetailReq) {
        return smsAssetProcessService.addProcessDetail(smsAssetProcessDetailReq);
    }

    @ApiModelProperty(value = "修改流程节点")
    @PostMapping("/update")
    public ResponseResult updateProcessDetail(@RequestBody SmsAssetProcessDetailReq smsAssetProcessDetailReq) {
        return smsAssetProcessService.updateProcessDetail(smsAssetProcessDetailReq);
    }

    @ApiModelProperty(value = "删除流程节点")
    @PostMapping("/delete")
    public ResponseResult deleteProcessDetail(@RequestBody SmsAssetProcessDetailDeleteReq smsAssetProcessDetailDeleteReq) {
        return smsAssetProcessService.deleteProcessDetail(smsAssetProcessDetailDeleteReq);
    }

    @ApiModelProperty(value = "流程列表")
    @GetMapping("/list")
    public ResponseResult getProcessList(@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                         @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
        return smsAssetProcessService.getProcessList(pageNum, pageSize);
    }

    @ApiModelProperty(value = "流程节点列表")
    @GetMapping("/detailList")
    public ResponseResult getProcessDetailList(@RequestParam("process_id") String process_id) {
        return smsAssetProcessService.getProcessDetailList(process_id);
    }

    @ApiModelProperty(value = "申请人指定流程（申请前获取）")
    @GetMapping("/appointProcessList")
    public ResponseResult getApplyOriginSettingProcess(@RequestParam(value = "process_type")Integer process_type) {
        return smsAssetProcessService.getApplyOriginSettingProcess(process_type);
    }
}

